package com.sdkj.service.admin.impl;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.hibernate.HibernateException;
import org.springframework.stereotype.Service;

import com.sdkj.Entity.admin.AdminModule;
import com.sdkj.service.admin.IAdminModuleService;
import com.sdkj.service.base.impl.BaseService;

@Service
public class AdminModuleServiceImpl extends BaseService<AdminModule> implements
		IAdminModuleService {

	@Override
	public List<AdminModule> findByUid(String uid) {
		String sql=" select module.uuid,module.name,module.icoUrl from admin_module module,admin_user_modules admin_modules where module.uuid=admin_modules.module_id and module.parent is null and user_id=:uid ";
		Map<String,Object>params=new HashMap<String,Object>();
		params.put("uid", uid); 
		try {
			return super.findBySqlToBean(sql, params, 1, 100);
		} catch (HibernateException | SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

}
